package test3;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ws
 * Date: 2023-04-01
 * Time: 15:09
 */
import java.util.*;

public class Main {
    static boolean[] prime = new boolean[1001];

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int num = scanner.nextInt();
        getPrime(num);
        int n = num / 2;
        int left = n;
        int right = n;
        while (true) {
            int sum = left + right;
            if (prime[left] && prime[right] && sum == num) {
                break;
            } else if (sum <= num) {
                right++;
                while (right <= num && !prime[right]) {
                    right++;
                }
            } else {
                left--;
                while (left > 1 && !prime[left]) {
                    left--;
                }
            }
        }
        System.out.println(left + "\n" + right);
    }

    public static void getPrime(int n) {
        Arrays.fill(prime, true);
        prime[0] = prime[1] = false;
        for (int i = 2; i <= n; i++) {
            if (prime[i]) {
                for (int j = i + i; j <= n; j += i) {
                    prime[j] = false;
                }
            }
        }
    }
}
